package com.neuedu.jxcboot.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.neuedu.jxcboot.common.bean.JsonResult;



/**
 * 全局异常
 * 
 * @author chens
 *
 */
@RestControllerAdvice
public class DefaultExceptionHandlerAdvice {
	
	private Logger logger = LoggerFactory.getLogger(DefaultExceptionHandlerAdvice.class);
	
	@ExceptionHandler(value = { Exception.class })
	public JsonResult exception(Exception exception) {
		logger.info(exception.getMessage(), exception);
		
		return new JsonResult(500, Boolean.FALSE, "错误操作或服务器发生了错误");
	}
}